package com.lody.virtual.client.hook.base;

import android.util.Log;

import java.lang.reflect.Method;

public class ReplaceUidMethodProxy extends StaticMethodProxy {

    private final int index;
    public ReplaceUidMethodProxy(String name, int index) {
        super(name);
        this.index = index;
    }

    @Override
    public boolean beforeCall(Object who, Method method, Object... args) {
        int uid = (int) args[index];
        Log.e("ZXY","ReplaceUidMethodProxy:"+uid+"BaseVUid:"+getBaseVUid());
        if (uid == getVUid() || uid == getBaseVUid()) {
            args[index] = getRealUid();
        }
        return super.beforeCall(who, method, args);
    }
}